package alkaid.eis.sys.controller;

import alkaid.eis.sys.entity.Dict;
import alkaid.eis.sys.entity.DictDetail;
import lombok.Data;

/**
 * 字典明细平面传输对象
 * 
 * @author Lucky Yang
 * @since 0.0.1
 */
@Data
public class DictDetailFlatDto {
    private Long dictId;

    /** 字典代码 */
    private String dictCode;

    /** 字典描述 */
    private String dictDescription;

    private Long id;

    /** 明细标签 */
    private String label;

    /** 明细代码 */
    private String code;

    /** 明细排序 */
    private Integer orderNo;

    /** 明细启用 */
    private Boolean enabled;

    public static DictDetailFlatDto of(DictDetail source) {
        DictDetailFlatDto rslt = new DictDetailFlatDto();

        rslt.setId(source.getId());
        rslt.setCode(source.getCode());
        rslt.setEnabled(source.getEnabled());
        rslt.setLabel(source.getLabel());
        rslt.setOrderNo(source.getOrderNo());

        Dict dict = source.getDict();
        rslt.setDictId(dict.getId());
        rslt.setDictCode(dict.getCode());
        rslt.setDictDescription(dict.getDescription());

        return rslt;
    }
}
